package com.danskin.wechat.service;

import java.util.List;

import com.alibaba.fastjson.JSONObject;
import com.danskin.wechat.entity.SceneQrcode;
import com.danskin.wechat.entity.SceneQrcodeStatisView;
import com.danskin.wechat.entity.WxAuthTicket;
import com.danskin.wechat.entity.WxCardConfig;
import com.danskin.wechat.entity.WxFansCard;
import com.danskin.wechat.entity.WxFansInfo;
import com.danskin.wechat.entity.WxFansInfoView;
import com.danskin.wechat.entity.WxFansMsg;
import com.danskin.wechat.entity.WxFansMsgReply;
import com.danskin.wechat.entity.WxFansMsgView;
import com.danskin.wechat.entity.WxMediaPlatform;
import com.danskin.wechat.entity.WxMenuClick;
import com.danskin.wechat.entity.WxMenuInfo;
import com.danskin.wechat.entity.WxMessage;
import com.danskin.wechat.entity.WxMessageNews;
import com.danskin.wechat.entity.WxMpFuncInfo;
import com.danskin.wechat.entity.WxMsgReplyDetail;
import com.danskin.wechat.util.Page;
import com.danskin.wechat.vo.WxMenuInfoVo;

/**
 * 微信运营服务接口
 * @author Allen Liu
 *
 */
public interface WechatOpService {

	/**
	 * 更新或保存微信授权凭据
	 * @param 凭据实体
	 * @return 无
	 * @throws 无
	 */
	void saveOrUpdateTicket(WxAuthTicket ticket);
	
	WxAuthTicket getAuthTicket(String appId); 

	void saveWxMediaPlatform(WxMediaPlatform entity);
	
	void saveMediaPlatformAndFunc(WxMediaPlatform entity, List<WxMpFuncInfo> funcs);
	 
	
	WxMediaPlatform queryMediaPlatform(int mpId);
	
	WxMediaPlatform queryMediaPlatformByAppId(String appId);
	
	List<WxMsgReplyDetail> findReplyDetailList(Page page);
	
	List<WxMsgReplyDetail> findReplyDetail(int mpId, String replyType);
	
	WxMsgReplyDetail findReplyDetailKeyword(int mpId, String keyword);
	
	void saveMsgReplyDetail(WxMsgReplyDetail entity);
	
	WxMsgReplyDetail queryMsgReplyDetail(int id, int mpId);
	
	int deleteMsgReplyDetail(int id, int mpId);
	
	void saveFansCard(WxFansCard entity);
	
	WxFansCard queryFansCard(String openId, String cardId, String userCardCode);
	
	void updateFansCard(WxFansCard entity);
	
	List<WxMenuInfo> queryAllMenu(int mpId);
	
	WxMenuInfo queryMenuInfo(int menuId, int mpId);
	/**
	 * 保存微信菜单信息
	 * @param entity
	 * @return
	 */
	int saveMenuInfo(WxMenuInfo entity);
	/**
	 * 保存微信菜单点击数据
	 * @param entity
	 * @return
	 */
	int saveMenuClick(WxMenuInfoVo menuInfo, String openId);
	
	int publishWechatMenu(String accessToken, int mpId);
	
	int deleteMenuInfo(int id, int mpId);
	
	WxMenuInfoVo findMenuInfoByMenuKey(int mpId, String menuKey);
	
	List<WxFansMsgView> findFansMsgList(Page page);
	
	int saveFansMsg(WxFansMsg entity);
	
	WxFansMsgView findFansMsgView(int msgId, int mpId);
	
	List<WxFansMsgReply> findFansMsgReplyByMsgId(int msgId, int mpId);
	/**
	 * 客服回复消息
	 * @param entity 回复消息实体
	 * @return
	 */
	int kfReplyMsg(String accessToken, WxFansMsgReply entity);
	
	List<WxFansInfoView> findFansInfoList(Page page);
	
	void syncFansFromWechat(String accessToken, int mpId);
	
	WxFansInfo saveFansInfo(String accessToken, int mpId, String openId, Integer custExId);
	
	WxFansInfo saveFansInfo(JSONObject userInfo, WxFansInfo fansInfo, int mpId, Integer custExId);
	
	WxCardConfig findCardConfig(String cardType,String appId);
	
	WxCardConfig findCardConfig(int mpId, String cardId);
	
	List<SceneQrcode> findSceneQrcodeList(Page page);
	
	SceneQrcode querySceneQrcode(int id, int mpId);
	
	SceneQrcode saveSceneQrcode(String access_token,SceneQrcode entity, String realPath);
	
	SceneQrcode saveSceneQrcodeWithReply(String access_token, SceneQrcode entity, String realPath, WxMessage message,List<WxMessageNews> news);
	
	int deleteSceneQrcode(int id, int mpId);
	/**
	 * 保存二维码扫描记录
	 * @param mpId
	 * @param sceneStr
	 * @param openId
	 * @param eventType
	 */
	SceneQrcode saveQrcodeStatis(int mpId, String sceneStr,String openId,Integer eventType);
	/**
	 * 分页查询二维码扫码统计数据
	 * @param page
	 * @return
	 */
	List<SceneQrcodeStatisView> findSceneQrcodeStatisList(Page page);
}
